import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {
  WorkPlanInspectionForm,
  WorkPlanInspectionQuery,
  WorkPlanInspectionVO
} from '@/api/painting/workPlanInspection/types';

/**
 * 查询工作计划质检列表
 * @param query
 * @returns {*}
 */

export const listWorkPlanInspection = (query?: WorkPlanInspectionQuery): AxiosPromise<WorkPlanInspectionVO[]> => {
  return request({
    url: '/painting/workPlanInspection/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工作计划质检详细
 * @param id
 */
export const getWorkPlanInspection = (id: string | number): AxiosPromise<WorkPlanInspectionVO> => {
  return request({
    url: '/painting/workPlanInspection/' + id,
    method: 'get'
  });
};

/**
 * 新增工作计划质检
 * @param data
 */
export const addWorkPlanInspection = (data: WorkPlanInspectionForm) => {
  return request({
    url: '/painting/workPlanInspection',
    method: 'post',
    data: data
  });
};

/**
 * 修改工作计划质检
 * @param data
 */
export const updateWorkPlanInspection = (data: WorkPlanInspectionForm) => {
  return request({
    url: '/painting/workPlanInspection',
    method: 'put',
    data: data
  });
};

/**
 * 删除工作计划质检
 * @param id
 */
export const delWorkPlanInspection = (id: string | number | Array<string | number>) => {
  return request({
    url: '/painting/workPlanInspection/' + id,
    method: 'delete'
  });
};
